package com.company;

import java.util.Collection;
import java.util.Deque;
import java.util.LinkedList;
import java.util.Queue;

public class QueueClass {
    public QueueClass() {
//        QueueCode();
        DequeCode();
    }

    void DequeCode(){
        Deque<String> deque = new LinkedList<>();
        deque.offerLast("end");
        deque.offerFirst("C");
        deque.offerFirst("B");
        deque.offerFirst("A");
        System.out.println(deque.pollLast());
        System.out.println(deque.pollFirst());
        System.out.println(deque.pollFirst());
        System.out.println(deque.pollFirst());
    }

    void QueueCode(){
        Queue<Person> queue = new LinkedList<>();
        queue.offer(new Person("ldq",12));
        queue.offer(new Person("link",13));
        queue.offer(new Person("ltx",14));
        System.out.println(queue.poll());
        System.out.println(queue.poll());
        System.out.println(queue.peek());
        if(!queue.isEmpty()){
            System.out.println(queue.remove());
        }
    }
}
